package com.jyu.hakkatranslation.controller;


import com.jyu.hakkatranslation.pojo.Root;
import com.jyu.hakkatranslation.service.RootServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
/*弃用*/
@Controller
public class RootController<UserServices> {

    @Autowired
    private RootServices rootServices;

//    @Autowired
//    private UserServices userServices;
/*

    @RequestMapping("/root/login")
    public String login(@RequestParam("root_name") String root_name,
                        @RequestParam("root_password") String root_password,
                        Model model,
                        HttpSession session) {
        Root root = rootServices.login(root_name,root_password);
        if (root!=null){
            session.setAttribute("Root1",root.getRootname());
            return "redirect:/main.html";
        } else {
            model.addAttribute("msg","用户名或密码错误");
            return "index";
        }
    }

    @RequestMapping("/root/logout")
    public String logout(HttpSession session){
        session.removeAttribute("Root1");
        return "index";
    }
*/

}
